import 'package:flutter/widgets.dart';

final ScalePageRoute = (Widget page) => PageRouteBuilder(
  pageBuilder: (context, animation, secondaryAnimation) => page,
  transitionsBuilder: (context, animation, secondaryAnimation, child) {
    // 定义缩放动画
    var scaleTween = Tween<double>(begin: 0.0, end: 1.0);
    // 定义透明度动画
    var opacityTween = Tween<double>(begin: 0.0, end: 1.0);
    return FadeTransition(
      opacity: animation.drive(opacityTween),
      child: ScaleTransition(
        scale: animation.drive(scaleTween),
        child: child,
      ),
    );
  },
  transitionDuration: const Duration(milliseconds: 500),
);